import Service from '@/common/service/service';
import ResponseModel from '@/common/model/response.model';
import LoginModel from '@/views/login/model/login.model';
import LoginResultModel from '@/views/login/model/login-result.model';
import RequestModel from "@/common/model/request.model";
import SwiperVerifyModel from "@/views/login/swiper-verify/model/swiper-verify.model";

/**
 */
export default class LoginService {
    /**
     * 验证码接口
     */
	public static getCode(params): Promise<ResponseModel<string>> {
		return Service.get('code', params as RequestModel)
	}

	/**
	 * 滑动验证码接口
	 */
	public static getSwiperCode(params): Promise<ResponseModel<SwiperVerifyModel>> {
		return Service.request({
			url:'jigsawCode',
			method:'get',
			params
		})
	}
	/**
	 * 校验滑动滑动验证
	 */
	public static checkSwiperCode(data): Promise<ResponseModel<boolean>> {
		return Service.request({
			url:'jigsawCodeCheck',
			method:'post',
			data
		})
		// return Service.post('jigsawCodeCheck',data)
	}

    /**
     * 登录接口
     */
    public static login(params: LoginModel): Promise<ResponseModel<LoginResultModel>> {
        return Service.get('auth/oauth/token', params)
    }

    /**
     * 登出接口
     */
    public static loginOut(): Promise<ResponseModel<LoginResultModel>> {
        return Service.get('sys/user/logout');
    }

    /**
     * 发送短信
     */
    public static sendSms(): Promise<ResponseModel<LoginResultModel>> {
        return Service.get('auth/oauth/token');
    }

}
